//
//  GTHotWordsCollectionViewCell.m
//  GiftTalk
//
//  Created by Wan on 16/3/25.
//  Copyright © 2016年 Wan. All rights reserved.
//  自定义热词按钮 CollectionViewCell

#import "GTHotWordsCollectionViewCell.h"
#import "GTButton.h"

@interface GTHotWordsCollectionViewCell()

/** 热词按钮 */
@property (weak, nonatomic) GTButton *titleButton;

@end

@implementation GTHotWordsCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        GTButton *button = [GTButton buttonWithType:UIButtonTypeCustom];
        button.cornerBoarderRadius = 4;
        button.cornerBoarderColor = GTRGBColor(230, 230, 230);
        [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
        button.titleLabel.font = GTHotWordsFont;
        // 这里注意要不使能用户交互，不然会拦截cell的点击
        button.userInteractionEnabled = NO;
        
        [self addSubview:button];
        self.titleButton = button;
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.titleButton.frame = self.bounds;
}

/**
 *  设置热词按钮上的文字
 */
- (void)setTitle:(NSString *)title
{
    _title = [title copy];
    
    [self.titleButton setTitle:title forState:UIControlStateNormal];
}
@end
